import request from '@/utils/request'

export function getDynamicFormData(params) {
  return request({
    url: '/maku-generator/form/service/get-form',
    method: 'get',
    params
  })
}

export function getDynamicFormConfigByKey(key) {
  return request({
    url: '/maku-generator/form/service/get-form-config/' + key,
    method: 'get'
  })
}

export function getDynamicFormConfig(params) {
  return request({
    url: '/maku-generator/gen_dynamic_form/get-dynamic-form',
    method: 'get',
    params
  })
}

export function updateDynamicFormConfig(data) {
  return request({
    url: '/maku-generator/gen_dynamic_form',
    method: 'put',
    data
  })
}

export function formCV(formId) {
  return request({
    url: '/maku-generator/gen_dynamic_form/cv/' + formId,
    method: 'post'
  })
}

export function saveDynamicFormGroup(data) {
  return request({
    url: '/maku-generator/gen_dynamic_form_group',
    method: 'post',
    data
  })
}

export function updateDynamicFormGroup(data) {
  return request({
    url: '/maku-generator/gen_dynamic_form_group',
    method: 'put',
    data
  })
}

export function batchSaveTableColumns(data) {
  return request({
    url: '/maku-generator/gen_dynamic_form_field/batch',
    method: 'post',
    data
  })
}

export function updateColumn(data) {
  return request({
    url: '/maku-generator/gen_dynamic_form_field',
    method: 'put',
    data
  })
}

export function batchUpdateColumn(data) {
  return request({
    url: '/maku-generator/gen_dynamic_form_field/batch',
    method: 'put',
    data
  })
}

export function deleteColumn(id) {
  return request({
    url: '/maku-generator/gen_dynamic_form_field/' + id,
    method: 'delete'
  })
}

export function exchangeSort(data) {
  return request({
    url: '/maku-generator/gen_dynamic_form_field/exchange/order',
    method: 'post',
    data
  })
}

export function getTableList(params) {
  return request({
    url: '/maku-generator/gen/table/page',
    method: 'get',
    params
  })
}

export function getTableColumnsByTableId(id) {
  return request({
    url: '/maku-generator/gen/table/' + id,
    method: 'get'
  })
}

